using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Cinemachine;
using FluffyUnderware.DevTools.Extensions;
using Yoozoo.UI.YGUI;

namespace com.yoozoo.gta.Art.BeautyGirl
{
    public class MenuOptionsForBeautyGirl : MonoBehaviour
    {
        [Header("美女UI根节点")][SerializeField] private GameObject menuParent; //美女整体UI界面的根节点
        [Header("主菜单")][SerializeField] private GameObject[] menuOptions = new GameObject[3]; // 切换'头发换色''换发型''换皮肤'功能的按钮
        [Header("菜单选中特效")][SerializeField] private GameObject[] menuOptionsEffect = new GameObject[3]; // 选中某一功能时的特效
        [Header("虚拟相机")][SerializeField] private CinemachineVirtualCamera[] virtualCamera = new CinemachineVirtualCamera[2]; // 换装和换发色时候的相机
        [Header("垂直滚动条")][SerializeField] private YScrollbar scrollbar; // 滚动条，用于重置控制美女整体UI界面的滚动

        public ChangeMaterialTool _changeMaterialTool;
        
        void Start()
        {
            menuParent.SetActive(true);
            menuOptions[0].SetActive(true);
            virtualCamera[0].SetActive(true);
        }

        public void ChangeMenu(int index)
        {
            for (int i = 0; i < menuOptions.Length; i++)
            {
                menuOptions[i].SetActive(index == i);
                menuOptionsEffect[i].SetActive(index == i);
                //virtualCamera[i].SetActive(index == i);
                if (index >= 1)
                {
                    virtualCamera[1].SetActive(true);
                    virtualCamera[0].SetActive(false);
                }
                else
                {
                    virtualCamera[0].SetActive(true);
                    virtualCamera[1].SetActive(false);
                }

                if (index == 1)
                {
                    _changeMaterialTool.OnChangeMaterial();
                }
            }
            scrollbar.value = 1;
        }
    }
}
